<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>产品销量统计</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<link href="cxcalendar.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script language="javascript" src="../script/Calendar-new.js"></script>
</head>
<body>
<div class="container">
    <div class="flow">
        <div class="itemtitle">
            <h3>产品销量统计</h3>
            <ul>
                <li class="current"><a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>"><span>管理</span></a></li>
			</ul>
			<ul style="float:right;">
                <li>
                    <form method="post" target="export_sell_iframe" id="export_sell_iframe" action=""><input type="hidden" value="export_sell" name="act"/></form>
                    <iframe src="" style="display:none;" id="export_sell_iframe" name="export_sell_iframe"></iframe>
                    <a href="javascript:;" onclick="$('#export_sell_iframe').submit();"><span>导出销量数据</span></a>
                </li>
            </ul>
        </div>
    </div>
    <div class="h35"></div>
    <form action="" method="get">
    <input type="hidden" name="m" value="<{$smarty.get.m}>">
    <input type="hidden" name="s" value="<{$smarty.get.s}>">
    <table class="select_table">
        <tr>    
            <td>
            	<div class="select_box">
            		<span style="float:left;">仓库：</span><select name="stock_shop" id="stock_shop" style="float:left;">
                <option value="" <{if $general_shop!=0}>disabled<{/if}>>全部</option>
                <{foreach item=list from=$stock_shops}>
                <option value="<{$list.id}>" <{if $smarty.get.stock_shop==$list.id}>selected<{/if}> <{if $general_shop!=0&&$general_shop!=$list.id}>disabled<{/if}>><{$list.title}></option>
                
                <{/foreach}>
                </select>
                </div>
                <span>&nbsp;&nbsp;&nbsp;&nbsp;下单时间：</span>
                <span>
                        <input class="w120 input_cxcalendar" type="text" name="stime" id="stime" value="<{$smarty.get.stime}>"">
                        -
                        <input class="w120 input_cxcalendar" type="text" name="etime" id="etime" value="<{$smarty.get.etime}>"">
                </span>
                <div style="display:inline-block;">
                	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="搜索" />
                	<a class="refresh" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>"></a>
                </div>
           </td>
        </tr>
    </table>
    </form>
    <table class="table product">
       <tbody>
       <tr class="header">
            <th width="50">商品ID</th>
            <th width="50">SKU_ID</th>
            <th width="60">条码code</th>
            <th width="80">商品图片</th>
            <th width="130">商品名称</th>
            <th width="60">商品规格</th>
            <th width="100">分销价</th>
            <th width="100">零售价</th>
            <th width="100">最低采购价</th>
            <th width="100">平均采购价</th>
            <th width="100">供应价</th>
            <th width="60">实际库存</th>
            <th width="60">虚拟库存</th>
            <th width="60">限购数量</th>
            <th width="100">销售数量</th>
            <th></th>
        </tr>
        <{foreach item=list from=$de.list}>
        <tr>
            <td><{$list.pid}></td>
            <td><{$list.product_id}></td>
            <td><{$list.barcode}></td>
            <td><a href="<{$list.pic}>" target="_blank"><img src="<{$list.pic}>/80" alt="" /></a></td>
            <td><{$list.product_name}></td>
            <td><{$list.property}></td>
            <td><{$config.money}><{$list.dis_price}></td>
            <td><{$config.money}><{$list.price}></td>
            <td><{$list.min_realpricebuy}> <{$list.currency_unit}></td>
            <td><{$list.avg_realpricebuy}> <{$list.currency_unit}></td>
            <td><{$list.pricebuy}> <{$list.currency_unit}></td>
            <td><{$list.stocks}></td>
            <td><{$list.canbuyout}></td>
            <td><{$list.buy_limit}></td>
            <td style="color:red;"><{$list.total_num}></td>
            <td><button class="history_button" productid="<{$list.product_id}>" shopid="<{$list.stock_shop}>">历史采购</button></td>
        </tr>
        <{foreachelse}>
        <tr>
            <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
        </tr>
        <{/foreach}>
		</tbody>
        <tfoot>
            <tr>
                <td colspan="99">
                	<div class="fl">每页最多显示： 20条</div>
                    <div class="page"><{$de.page}></div>
                    <div class="fr">共有<{$de.count}>条记录</div>
                </td>
            </tr>
        </tfoot>
    </table>
<script>
//查看采购历史
$('.history_button').click(function(){
	var productid = $(this).attr('productid');
	var shopid = $(this).attr('shopid');
	window.parent.iframe_form("purchases", '历史采购', 'module.php?m=inventory&s=historyPurchases.php&id='+productid+'&shopid='+shopid, 1000, 600);
	return false;
});

//时间搜索
$('.input_cxcalendar').each(function(){
    var a = new Calendar({
        targetCls: $(this),
        type: 'yyyy-mm-dd HH:MM:SS',
        wday:2
    },function(val){
        console.log(val);
    });
});
</script>    
</div>
</body>
</html>